package com.woniuxy.springparking.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.woniuxy.springparking.common.RestResult;
import com.woniuxy.springparking.dao.McarParkingDao;
import com.woniuxy.springparking.pojo.McarParking;
import com.woniuxy.springparking.pojo.TPerStall;
import com.woniuxy.springparking.service.McarParkingService;
import com.woniuxy.springparking.vo.McarParkingVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class McarParkingServiceImpl implements McarParkingService {
    @Autowired
    McarParkingDao mcarParkingDao;
    @Override
    public RestResult seletMPByPage(McarParkingVo mpVo) {
        Page<Object> pages = PageHelper.startPage(mpVo.getPage(),mpVo.getLimit());
        List<McarParking> data=this.mcarParkingDao.selectMParkingByPage(mpVo);
//        String[] sourceStrArray = mpVo.getMerchantUsers().getLnglat().split(",");
//            mpVo.setLnglat1(sourceStrArray[0]);
//        mpVo.setLnglat2(sourceStrArray[1]);
//        data.add(mpVo.getLnglat1());
//        data.add(mpVo.getLnglat2());
        return new RestResult(pages.getTotal(),data);
    }

    @Override
    public void delMC(Integer id) {
        this.mcarParkingDao.deleteById(id);
    }
}
